<template>
    <div class="channel-detail">

        <Row>
            <Col span="23" style="background:white">

            <Row>
                <Col span="20" class="form-back">
                <Row>
                    <Col span="4">
                    <p class="notwrap">通知名称:</p></Col>
                    <Col span="14" class="padding-left-8">
                    {{ format.title }}</Col>
                </Row>

                <Row class="margin-top-8">
                    <Col span="4">
                    <p class="notwrap">通知内容:</p></Col>
                    <Col span="14" class="padding-left-8" v-html="format.context"></Col>
                </Row>
                <Row>
                    <VTable :init='columns'
                            :defaultValue="defaultVal"
                            :pages='false'
                            @changed="tableCall"
                            :loading="loading"></VTable>
                </Row>


                <div style="margin-top:40px;margin-left:100px">
                    <Button type="primary" class="tablePageBtnStyle" @click="back()">返回</Button>
                </div>
                </Col>
                <Col span="12"></Col>
            </Row>

            </Col>
            <Col span="1"></Col>
        </Row>


    </div>
</template>

<script>

    import systemApi from '../../api/api'
    import dateFormat from '../../tool/date'
    import codeManage from '../../api/statusCodeManage';


    export default {
        name: 'channelDetail',
        data() {
            return {

                format: {
                    title: '',
                    context: ''
                },
                loading:false,
                columns:{
                    url: 'allAPI.getnoticeStatListById',
                    cols: [
                        {
                            title: '序号',
                            type: 'index',
                            align: 'center',
                            width: 60
                        },
                        {
                            title: '查看人',
                            align: 'center',
                            key: 'name',
                            width: 200
                        },
                        {
                            title: '查看时间',
                            align: 'center',
                            key: 'addTime',
                            width: 200,
                            render:function (h,params) {
                                return dateFormat(params.row.addTime,'YYYY-MM-DD 星期E HH:mm')
                            }
                        },
                        {
                            title: ' '
                        }
                    ]
                },
                defaultVal:{
                    id:''
                }
            }

        },

        methods: {
            tableCall(){

            },
            //获取渠道详情
            getDetail(noteceId) {
                let _this = this;

                systemApi.allAPI.getNoteceById({id: noteceId}).then(
                    res => {
                        if (res.code === 0) {
                            _this.format = res.data;
                        }else{
                            codeManage.showTipOfStatuCode({}, this,res.msg);
                        }
                    },
                    err => {
                        codeManage.showTipOfStatuCode(err, this);
                    }
                )
            },
            //返回
            back() {
                history.back();
            }

        },

        created() {
            this.getDetail(this.$route.query.id);
            this.defaultVal.id = this.$route.query.id;
        },


    }
</script>


<style lang="less">

    @import '../../styles/main';

    .channel-detail {
        margin-top: 15px;
        margin-left: 15px;

        .form-back {
            margin-top: 20px;
            padding: 10px;
            margin-left: 20px;
            margin-bottom: 100px;
            font-size: 13px;
        }
        .rowItem {
            margin-top: 10px;
        }
        .margin-top-8 {
            margin-top: 25px;
        }
        .notwrap {
            text-align: center;
        }
    }


</style>
